<!DOCTYPE html>
<html lang="en">  
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>国有企业招聘</title>
  <link rel="stylesheet" href="./styles/common.css">
</head>

<body>
  <script src="http://rsj.beijing.gov.cn/images/rsj_header.js"></script>
  <!-- 公共头部 -->
  <include src="./include/header.html"></include>

  <!-- 内容区域 -->
  <!-- 申请提示开始 -->
  <div class="message qyxx">
    <div class="content clearfix">
      <div class="zuo left boxShadow">
        <div class="titles concommon">
          <h3>
            <a href="./index.html">
              《 返回</a> | 企业基本信息 </h3>
        </div>
        <div class="leftcon" id="detailWrap">
          <script type="text/html" id="detailTem">
            <%if(data.executeResult == 1){%>
            <% var _data = data.dwxx%>
            <form class="qyform" name="form_info" msgtype="2" validate="blur">
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>统一社会信用代码：</p>
                  <p class="text_r"><%=_data.zjhm%> </p>
                  <input type="text" paramete="dwbh" value="<%=_data.dwbh%>" style="display:none;">
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>单位全称：</p>
                  <p class="text_r">
                    <input type="text" paramete="dwmc" v_require valiflag="128,full,单位全称" value="<%=_data.dwmc%>"
                      title="<%=_data.dwmc%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>单位行业：</p>
                  <p class="text_r">
                    <input type="text" class="Cascade J_dwhy" valiflag="128,full,单位行业" v_require
                      xzqhid="<%=_data.dwhy%>" value="<%=_data.dwhy_mc%>" title="<%=_data.dwhy_mc%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>单位性质：</p>
                  <p class="text_r">
                    <select id="dwxz" paramete="dwxz" valiflag=" , ,单位性质" v_require></select>
                  </p>
                </div>
              </div>
              <div class="col clearfix hide J_qtlx">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>其他登记注册类型：</p>
                  <p class="text_r">
                    <select id="qtlx" paramete="qtdjzclx" valiflag=" , ,其他登记注册类型"></select>
                  </p>
                </div>
              </div>
              <div class="col clearfix J_qylx">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>企业登记注册类型：</p>
                  <p class="text_r line_2">
                    <select class="J_qyxz" id="J_qyxz" paramete="qydj_yj" valiflag="3,full,企业登记注册类型" v_require></select>
                    <select id="J_qyxz_child" paramete="qydjzclx">
                      <option value="">--</option>
                    </select>
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>企业规模：</p>
                  <p class="text_r">
                    <select id="qygm" paramete="qygm" valiflag=" , ,企业规模" v_require></select>
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>主营业务：</p>
                  <p class="text_r">
                    <input type="text" paramete="zyyw" valiflag="64,full,主营业务" v_require value="<%=_data.zyyw%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>单位经办人：</p>
                  <p class="text_r">
                    <input type="text" paramete="dwjbr" valiflag="32,full,单位经办人" v_require value="<%=_data.dwjbr%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>注册地行政区划：</p>
                  <p class="text_r">
                    <input type="text" class="Cascade" id="J_zcdz" v_require valiflag="128,full,注册地行政区划"
                      xzqhid="<%=_data.zcdxzqh%>" value="<%=_data.zcdxzqh_mc%>" title="<%=_data.zcdxzqh_mc%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>经营地行政区划：</p>
                  <p class="text_r">
                    <input type="text" class="Cascade" id="J_jydz" v_require valiflag="128,full,经营地行政区划"
                      xzqhid="<%=_data.jydxzqh%>" value="<%=_data.jydxzqh_mc%>" title="<%=_data.jydxzqh_mc%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>经营地址：</p>
                  <p class="text_r">
                    <input class="Cascade" type="text" paramete="jydz" v_require valiflag="128,full,经营地址"
                      value="<%=_data.jydz%>">
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>是否国企：</p>
                  <p class="text_r">
                    <select id="sfgq" paramete="sfgq" valiflag=" , ,是否国企" v_require>
                      <option value="1">是</option>
                      <option value="0">否</option>
                    </select>
                  </p>
                </div>
              </div>
              <div class="col clearfix J_sjdw">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>所属一级企业：</p>
                  <p class="text_r">
                    <select id="sjdw" paramete="sjdw" valiflag=" , ,所属一级国企单位" v_require class="Cascade"></select>
                  </p>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l"><span style="color:red;">*</span>企业LOGO：</p>
                  <div class="ht_img_wrap clearfix text_r J_img_wrap">
                    <%if(_data.logo != null){%>
                    <div class="img_wrap" params="<%=_data.logo%>">
                      <input type="hidden" class="filevalue_name filevalue" value="">
                      <img class="img_upload">
                      <i class="del J_tpdel" title="删除"></i>
                    </div>
                    <%}%>
                    <label for="fileupload" class="file_upload"></label>
                    <input type="file" accept=".jpg,.png" name="sctp" class="inputfile tp_upload"
                      id="fileupload">
                    </div>
                    <div class="tsxx">请上传小于200K的jpg;png格式的图片</div>
                </div>
              </div>
              <div class="col clearfix">
                <div class="row">
                  <p class="text_l">单位简称：</p>
                  <p class="text_r">
                    <input type="text" paramete="dwjc" valiflag="32,full,单位简称" value="<%=_data.dwjc%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">经办人身份证：</p>
                    <p class="text_r">
                      <input type="text" paramete="jbrsfz" valiflag="18,sfzhm,经办人身份证" value="<%=_data.jbrsfz%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">联系人电话：</p>
                    <p class="text_r">
                      <input type="text" paramete="lxrdh" valiflag="32,lxdh,联系人电话" value="<%=_data.lxrdh%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">联系人手机：</p>
                    <p class="text_r">
                      <input type="text" paramete="lxrsj" valiflag="11,sjh,联系人手机" value="<%=_data.lxrsj%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">邮政编码：</p>
                    <p class="text_r">
                      <input type="text" paramete="yzbm" valiflag="128,yb,邮政编码" value="<%=_data.yzbm%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">E-mail：</p>
                    <p class="text_r">
                      <input type="text" paramete="email" valiflag="48,email,E-mail" value="<%=_data.email%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">传真机号：</p>
                    <p class="text_r">
                      <input type="text" paramete="czjh" valiflag="32,full,传真机号" value="<%=_data.czjh%>">
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">目前经营情况：</p>
                    <p class="text_r">
                      <select id="jyqk" paramete="mqjyzk" valiflag=" , ,目前经营情况"></select>
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">经营状况估计：</p>
                    <p class="text_r">
                      <select id="zkyg" paramete="jyzkgj" valiflag=" , ,经营状况估计"></select>
                    </p>
                  </div>
                </div>
                <div class="col clearfix">
                  <div class="row">
                    <p class="text_l">企业用人规模(用人总人数)：</p>
                    <p class="text_r">
                      <input type="text" paramete="qyyrgm" valiflag="16,num,企业用人规模(用人总人数)" value="<%=_data.qyyrgm%>">
                    </p>
                  </div>
                </div>
            </form>
            <div class="alertBtn alertCommon">
              <button class="btn btn_blue_deep J_sub">确定</button>
            </div>
            <%}%>

          </script>
        </div>
      </div>
      <!-- 公用右侧企业信息模块 -->
      <include src="./include/rightbox.html"></include>
    </div>
  </div>
  <!-- 公共尾部 -->
  <script src="http://rsj.beijing.gov.cn/footer.js"></script>
</body>
<script src="./common/vendor.js"></script>
<script src="./common/common.js"></script>
<script src="./common/validator.js"></script>
<script src="./common/levelPlugin.js"></script>
<script>
  $(function () {
    var loading = new $.Loading();
    // 单位类型选择10其他
    $(document).on('change', '#dwxz', function () {
      if ($(this).val() == "90") { //90其他
        $('.J_qylx').hide().find('select').removeAttr('v_require');
        $('.J_qtlx').show().find('select').attr('v_require', '');
      } else if ($(this).val() == "10") { // 10 企业
        $('.J_qylx').show().find('select').attr('v_require', '');
        $('.J_qtlx').hide().find('select').removeAttr('v_require');
      } else {
        $('.J_qtlx').hide().find('select').removeAttr('v_require');
        $('.J_qylx').hide().find('select').removeAttr('v_require');
      }
    })
    //点击企业性质
    $(document).on('change', '.J_qyxz', function () {
      var qyxz_id = $(this).val(); //获取代码id
      $.renderCode('/dmbgl/ycjdmbCx', $('#J_qyxz_child'), ['cdg_regtype', qyxz_id], 'cdl_orgtype');
    })
    //点击是否国企
    $(document).on('change', '#sfgq', function () {
      if ($(this).val() == 1) {
        $('.J_sjdw').show().find('select').attr('v_require', '');
      } else {
        $('.J_sjdw').hide().find('select').removeAttr('v_require').val('');
      }
    })
    //上级单位
    $(document).on('change', '#sjdw', function () {
      var tit = $(this).find("option:selected").text();
      $(this).attr('title', tit)
    })
    // 回显
    searchCx();
    // 上传图片
    $('body').on('change', '.tp_upload', function () {
      var $this = $(this);
      $this.upload({
        success: function (res) {
          var data = res.returnData;
          var flag = parseInt(data.executeResult, 10);
          if (flag === 1) {
            var src = conf.urlPrefix + '/wjsc/showPicture?servername=' + data.fjServername; // 文件流的方式
            // var src = $.base64(data.wjxx.serverName) + data.wjxx.sltlj;// base64 方式
            // 判断 item 是否存在
            // var imgWrap = $this.siblings('.ht_img_wrap');
            var imgWrap = $this.parent('.ht_img_wrap')
            var imgItem = $('<div class="img_wrap" params=' + data
              .fjServername + '>' +
              '<input type="hidden" class="filevalue_name filevalue">' +
              '<img class="img_upload">' +
              '<i class="del J_tpdel" title="删除"></i>' +
              '</div>');
            if (imgWrap.find('.img_wrap').length === 0) {
              $this.siblings('.file_upload').hide();
            }
            imgWrap.prepend(imgItem);
            // 赋值
            imgItem.find('img').attr('src', src);
            imgItem.find('.filevalue_name').val(data.fjServername);
          } else {
            $.layerMsg(data.message, '确定');
          }
          cloneUploadDom($this);
        },
        error: function (res) {
          cloneUploadDom($this);
        }
      });
    });
    /**
     * clone文件上传DOM对象，解决change时无法再次上传的问题
     * @param {jQuery} $dom jquery对象
     */
    function cloneUploadDom($dom) {
      var clone$dom = $dom.clone();
      clone$dom.val('');
      $dom.after(clone$dom).remove();
    }
    // 删除图片
    $('body').on('click', '.J_tpdel', function (e) {
      var $this = $(this);
      $this.parents('.img_wrap').remove();
      if ($('.ht_img_wrap .img_wrap').length <= 0) {
        $('.J_img_wrap .file_upload').show();
      }
    });

    function searchCx() {
      loading.on();
      return $.asyncRender({
        url: '/dwgl/dwxxCx',
        get: 'get',
        pos: 'returnData',
        tem: '#detailTem',
        wrap: '#detailWrap'
      }).done(function (result) {
        loading.off();
        var data = result.returnData;
        if (data.executeResult === '1') {
          loadValid();
          var _data = data.dwxx;
          $('.J_dwhy').pull($.setLinkageLocl()); //单位行业
          $('#J_zcdz').pull($.setLinkageLocl_get()); //注册地行政区划
          $('#J_jydz').pull($.setLinkageLocl_get()); //经营地行政区划
          $.renderCode('/dmbgl/dmblbCx', $('#dwxz'), 'cdl_orgtype', 'cdl_orgtype', _data.dwxz); //单位性质
          $.renderCode('/dmbgl/dmblbCx', $('#qygm'), 'zyjs_d_qygm', 'zyjs_d_qygm', _data.qygm); //企业规模
          $.renderCode('/dmbgl/dmblbCx', $('#qtlx'), 'cdl_orgtype_01', 'cdl_orgtype_01', _data
            .qtdjzclx); //其他登记注册类型
          $.renderCode('/dmbgl/ycjdmbCx', $('#J_qyxz'), 'cdg_regtype', 'cdl_orgtype', _data.qydj_yj); //企业登记注册类型
          $.renderCode('/dmbgl/ycjdmbCx', $('#J_qyxz_child'), ['cdg_regtype', _data.qydj_yj], 'cdl_orgtype',
            _data.qydjzclx);
          $.renderCode('/dmbgl/dmblbCx', $('#jyqk'), 'zyjs_d_mqjyzk', 'zyjs_d_mqjyzk', _data.mqjyzk); //目前经营情况
          $.renderCode('/dmbgl/dmblbCx', $('#zkyg'), 'zyjs_d_wljyqkgj', 'zyjs_d_wljyqkgj', _data
            .jyzkgj); //经营状况预估
          $.checkCode('/dwgl/sjqyCx', $('#sjdw'), 'sjqy', _data.sjgq); //经营状况预估
          //是否一级企业
          if (_data.sfyjgq == 1) {
            $('.J_sjdw').hide().find('select').removeAttr('v_require').val('');
            $('#sfgq').val('1').attr('disabled', true);
          } else {
            //不是一级企业
            $('.J_sjdw').show();
            $('#sfgq').removeAttr('disabled').val(_data.sfgq);
            //国企sfgq 0不是; sfgq 1是
            if (_data.sfgq == 0) {
              $('.J_sjdw').hide().find('select').removeAttr('v_require').val('');
            } else if (_data.sfgq == 1) {
              $('#sfgq').val('1').attr('disabled', true);
              $('#sjdw').attr('disabled', true);
            }
          }
          // 其他岗位
          if (_data.dwxz == "90") { //90其他
            $('.J_qylx').hide().find('select').removeAttr('v_require');
            $('.J_qtlx').show().find('select').attr('v_require', '');
          } else if (_data.dwxz == "10") { // 10 企业
            $('.J_qylx').show().find('select').attr('v_require', '');
            $('.J_qtlx').hide().find('select').removeAttr('v_require');
          } else {
            $('.J_qtlx').hide().find('select').removeAttr('v_require');
            $('.J_qylx').hide().find('select').removeAttr('v_require');
          }
          if ($('.J_img_wrap').find('.img_wrap').length === 0) {
            $('.J_img_wrap .file_upload').show();
          } else {
            $('.J_img_wrap .file_upload').hide();
          }
          if (_data.logo) {
            $('.J_img_wrap').find('.img_upload').attr('src', conf.urlPrefix + '/wjsc/showPicture?servername=' + _data.logo);
          }
        }
      })
    }

    // 确定提交
    $(document).on('click', '.J_sub', function () {
      var _data = $('form[name="form_info"]').getFormData();
      if (validate('form_info')) {
        var _param = getMayDmbId([{
          name: '.J_dwhy',
          value: 'dwhy'
        }, {
          name: '#J_zcdz',
          value: 'zcdxzqh'
        }, {
          name: '#J_jydz',
          value: 'jydxzqh'
        }])
        var data = $.obj_extend(_param, _data);
        var imgName = $('.img_wrap').attr('params');
        if (data.sfgq == "1" && !imgName) {
          $.layerMsg('请上传企业LOGO！', '确定')
          return;
        }
        data.logo = imgName;
        if (data.lxrsj || data.lxrdh) {
          // 其他岗位
          if (_data.dwxz == "90") { //90其他
            _data.qydj_yj = '';
            _data.qydjzclx = '';
          } else if (_data.dwxz == "10") { // 10 企业
            _data.qtdjzclx = "";
          } else {
            _data.qydj_yj = '';
            _data.qydjzclx = '';
            _data.qtdjzclx = "";
          }
          $.layerMsg('是否保存?', [{
            text: '是',
            cb: function () {
              $.fetch({
                url: '/dwgl/dwxxBc',
                type: 'post',
                data: data
              }).done(function (res) {
                var _res = res.returnData;
                if (+_res.executeResult == 1) {
                  $.layerMsg('操作成功', [{
                    text: '确定',
                    cb: function () {
                      window.location.href = './index.html';
                    }
                  }])
                } else {
                  $.layerMsg(_res.message, '确定');
                }
              })
            }
          }, {
            text: '否',
            cb: function () {}
          }])
        } else {
          $.layerMsg('请填写电话或手机！', '确定')
          return
        }

      }
    })

    function getMayDmbId(params) {
      var _obj = {};
      for (var i = 0; i < params.length; i++) {
        if ($(params[i].name).data('data') == undefined) {
          _obj[params[i].value] = $(params[i].name).attr('xzqhid');
        } else {
          _obj[params[i].value] = $(params[i].name).data('data').id;
        }
      }
      return _obj;
    }
  });

</script>

</html>
